<template>
  <div class="like-page">
    <van-nav-bar title="我的点赞"></van-nav-bar>
    <van-search v-model="value" placeholder="请输入搜索关键词" />
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <ArticleItem v-for="(item,i) in list" :key="i" :item="item" />
    </van-list>
  </div>
</template>

<script>
import { getArticlesLike } from '@/api/article'
export default {
  name: 'LikePage',
  data () {
    return {
      list: [],
      value: '',
      loading: false,
      finished: false,
      page: 1,
      pageSize: 10
    }
  },
  methods: {
    async onLoad () {
      const res = await getArticlesLike({
        page: this.page,
        pageSize: this.pageSize,
        optType: 1
      })
      // console.log(res.data.rows)
      this.list.push(...res.data.rows)
      this.loading = false
      this.page++

      if (this.page > res.data.pageTotal) {
        this.finished = true
      }
    }
  }
}
</script>

<style lang="less" scoped>

</style>
